#ifndef GLOBAL_H
#define GLOBAL_H

//内部圆半径比例因子
#define RADIUS_FACTOR 0.8

//外部圆开始和停止颜色
#define OUTER_CIRCLE_START_COLOR QColor(65,65,65)
#define OUTER_CIRCLE_END_COLOR QColor(89,89,89)

//内部圆的蓝色
#define BLUE_CIRCLE_START_COLOR QColor(0,133,203)
#define BLUE_CIRCLE_END_COLOR QColor(0,118,177)
//内部圆的白色
#define WHITE_CIRCLE_START_COLOR QColor(255,255,255)
#define WHITE_CIRCLE_END_COLOR QColor(233,233,233)

#include <QWidget>
#include <QSize>
#include <QTimer>
#include <QtGui>
#include <QPixmap>
#include <QDebug>

#include <QFrame>
#include <QLabel>

#include <QString>
#include <QVBoxLayout>
#include <QScrollArea>
#include <QGridLayout>

#include <QListWidgetItem>

class MainWidget : public QWidget
{
    Q_OBJECT

public:
    explicit MainWidget(QWidget *parent = 0);
    ~MainWidget();
/*
protected:
    void paintEvent(QPaintEvent *event);

    QSize sizeHist() const{
        return QSize(300, 300);
    }

private:
    void drawUnderCircle(QPainter* painter);

    void drawBMW(QPainter* painter);

private:
    QTimer* m_updateTimer;
    qreal m_angle;
    qreal m_outerRadius;

private slots:
    void UpdateAngle();*/
};

class Item : public QWidget
{
    Q_OBJECT
public:
    Item(QWidget *parent, QString avator, QString title,
         QString last_update, QString content);

    ~Item();

    void add_picture(QString w);

private:
    QHash<QString, QLabel*> labels;
    QHash<QString, QString> names;
    QList<QString> pictures;

    void add_attr(QString attr, QString data);
    QString get_attr(QString attr);
    QLabel* get_label(QString attr);

    int count;
};


class PictureViewer: public QWidget
{
    Q_OBJECT
public:
    PictureViewer(QString);
    ~PictureViewer();

protected:

    void keyPressEvent(QKeyEvent *event);

    void mousePressEvent(QMouseEvent *event);
    void mouseReleaseEvent(QMouseEvent *event);
    void mouseMoveEvent(QMouseEvent *event);

private:
    QString file_path;
    QLabel *center = NULL;
    QMovie *movie = NULL;
    QPixmap *pixmap = NULL;
};


#endif
